package xin.petstore.framework.utils;


public class StringBufferUtil {

    private StringBufferUtil() {
    }

    /**
     * 添加字符串数组以及间隔符
     *
     * @param sb
     * @param params
     * @return
     */
    public static StringBuffer addWithSeparator(StringBuffer sb, String[] params, String separator) {
        for (String param : params) {
            addWithSeparator(sb, param, separator);
        }
        return sb;
    }

    /**
     * 添加字符串以及间隔符
     *
     * @param sb
     * @param param
     * @return
     */
    public static StringBuffer addWithSeparator(StringBuffer sb, String param, String separator) {
        sb.append(param);
        sb.append(separator);
        return sb;
    }


    /**
     * 添加long以及间隔符
     *
     * @param sb
     * @param param
     * @return
     */
    public static StringBuffer addWithSeparator(StringBuffer sb, long param, String separator) {
        return addWithSeparator(sb, String.valueOf(param), separator);

    }


}
